var nodemailer = require('nodemailer')  
var smtpTransport = require('nodemailer-smtp-transport');  
var config = require('./config')

smtpTransport = nodemailer.createTransport(smtpTransport({  
    service: 'QQ',
    auth: {
        user: '156432817@qq.com',
        pass: 'dlpkkscadkvdbhdb'
    }
}));

/**
 * @param {String} recipient 收件人
 * @param {String} subject 发送的主题
 * @param {String} html 发送的html内容
 */
var sendMail = function (recipient, subject, html,fn) {

    smtpTransport.sendMail({

        from: '156432817@qq.com',
        to: recipient,
        cc:'757081461@qq.com',
        subject: subject,
        html: html

    }, function (error, response) {
        if (error) {
            console.log(error);
        }
        console.log('发送成功');
        console.log(response);
        fn(error, response);
    });
}

module.exports = sendMail;  